//
//  MineCell.m
//  PropertyMananger
//
//  Created by Mansion on 16/12/23.
//  Copyright © 2016年 BH. All rights reserved.
//

#import "MineCell.h"

@implementation MineCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *mineCellID = @"mineCellID";
    MineCell * mineCell = [tableView dequeueReusableCellWithIdentifier:mineCellID];
    if (!mineCell) {
        
        mineCell = [[MineCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:mineCellID];
    }
    mineCell.selectionStyle = UITableViewCellSelectionStyleNone;
    mineCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; //显示最右边的箭头
    return mineCell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.iconImg = [[UIImageView alloc]init];
        [self.contentView addSubview:self.iconImg];
        
        [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.leading.equalTo(self.contentView).with.offset(15);
            make.centerY.equalTo(self.contentView).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
        
        //title
        self.titleLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.titleLabel];
        self.titleLabel.font = BHFont(15);
        self.titleLabel.textAlignment = NSTextAlignmentLeft;
        self.titleLabel.textColor = BHColor(51, 51, 51);
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.iconImg.mas_trailing).with.offset(15);
            make.centerY.equalTo(self.contentView).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(70, 30));
        }];
        
        self.messageIcon = [[UIImageView alloc]init];
        [self.contentView addSubview:self.messageIcon];
        
        [self.messageIcon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.titleLabel.mas_trailing).with.offset(5);
            make.centerY.equalTo(self).with.offset(0);
            make.height.mas_equalTo(20);
        }];
        
       
        
//        self.arrowImg = [[UIImageView alloc]init];
//        [self.contentView addSubview:self.arrowImg];
//        self.arrowImg.image = [UIImage imageNamed:@"ico_work_order_next"];
//        
//        [self.arrowImg mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.trailing.equalTo(self.contentView).with.offset(-15);
//            make.centerY.equalTo(self.contentView).with.offset(0);
//            make.size.mas_equalTo(CGSizeMake(12, 16));
//        }];
        
    }
    
    return self;
}

@end
